-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: handle when auto updater receives a non-200 from GitHub API #351
fix: handle when auto updater receives a non-200 from GitHub API #351
Conversation
lib/next_ls/updater.ex
Outdated
@@ -65,6 +65,12 @@ defmodule NextLS.Updater do | |||
end | |||
end | |||
|
|||
{:ok, %{status: 403, body: %{"message" => msg}} = _body} -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding these two specific checks, let's make the existing check less specific (don't pattern match on the error atom).
Keep the status 200 in the first check tho
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, no problem. By "error atom" do you mean the status
field, or the "message"
field? (I wasn't sure if Github returns a message
for non-403 responses.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I mean the atom on line 74
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
thanks! |
This is a minimal fix to the crash reported in #350 - e.g. Github API returns a 403 or other non-200 error. (Github's API docs do not make it easy to find the response schema for errors, only successes, unfortunately.)
Fixes #350